<?php die;?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>miceCMS,觅策企业网站管理系统</title>
<link href="css/default.css" rel="stylesheet" type="text/css">
<link href="css/table.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
function changeimg()
{
	var a=document.imgform.imgs.value.split(".");
	var b=a[a.length-1];
	if(b=="jpg" || b=="gif" || b=="bmp" || b=="png" || b=="ico"){
		document.imgform.img1.src=document.imgform.imgs.value;
	}else{
		document.imgform.img1.src="<!--{$smarty.const.MICE_URL}-->uploads/blank.gif";
	}
	return true;
}

function fileurl()
{
	if(document.imgform.imgs.value){
		copyToClipboard(document.imgform.imgs.value);
	}else{
		alert("您未选择任何文件");
	}
	return true;
}

function copyToClipboard(txt) {
      if(window.clipboardData) {
              window.clipboardData.clearData();   
              window.clipboardData.setData("Text", txt);   
			  alert(txt+"\n文件地址复制成功");
      } else if(navigator.userAgent.indexOf("Opera") != -1) {
           alert("您所用的浏览器暂不支持JS复制功能\n请直接复制文本框中的内容");   
      } else if (window.netscape) {   
           try {   
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");   
           } catch (e) {   
                alert("被浏览器拒绝！\n请直接复制文本框内的内容\n或\n在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");   
           }   
           var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);   
           if (!clip)   
                return;   
           var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);   
           if (!trans)   
                return;   
           trans.addDataFlavor('text/unicode');   
           var str = new Object();   
           var len = new Object();   
           var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);   
           var copytext = txt;   
           str.data = copytext;   
           trans.setTransferData("text/unicode",str,copytext.length*2);   
           var clipid = Components.interfaces.nsIClipboard;   
           if (!clip)   
                return false;   
           clip.setData(trans,null,clipid.kGlobalClipboard);   
           alert("复制成功\n"+txt);
      }
}
</script>
</head>
<body>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
  <form action="" method="post" name="imgform" id="imgform">
  <tr>
    <td>请输入您要插入的文件扩展名，如gif或jpg<br>查找所有文件，扩展名为空</td>
  </tr>
  <tr>
    <td>扩展名：
<input type="text" name="extname" size="8" value="<!--{$extname}-->">&nbsp;<input type="submit" value="查找"/>&nbsp;<input type="button" name="uploadfile"  onclick="window.location.href='<!--{$smarty.const.MICE_URL}-->admin.php/upload/iframe'" value="上传文件" /></td>
  </tr>
  <tr>
    <td><select name="imgs" id="imgs" onchange="changeimg()"  size="12">  
<!--{section name=cn loop=$table_data}-->   
  <option   value="<!--{$smarty.const.MICE_URL}-->uploads/<!--{$table_data[cn].id}-->"><!--{$table_data[cn].id}--></option>
  <!--{/section}-->
</select></td>
  </tr>
  <tr>
    <td><input type="button" name="copyurl" onclick="fileurl()" value="复制选中的文件地址" /></td>
  </tr>
  <tr>
    <td><img id="img1" src="<!--{$smarty.const.MICE_URL}-->uploads/blank.gif" width="100px" height="100px"></td>
  </tr>
  </form>
</table>
</body>
</html>
